<?php

namespace app\model\school;

use app\BaseModel;
use app\model\not_del\UserModel;
use think\model\relation\BelongsTo;

/**
 * 心理学堂-课程-心得（学习记录）
 */
class SchoolCourseChapterLearningModel extends BaseModel
{
    protected $name = 'school_course_chapter_learning';


    /**
     * 用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind([
            'user_name' => 'name',
            'avatar',
            'sex'
        ]);
    }

    /**
     * 测评结果
     * @return BelongsTo
     */
    public function result(): BelongsTo
    {
        return $this->belongsTo(SchoolCourseChapterResultModel::class,'result_id')->bind([
            'is_warning',
            'rating_scale_name'
        ]);
    }


}